import { Button, Modal, Table } from 'antd';
import { useState, useEffect } from 'react'
import Xq from './Xq';
import LoopMsgAPi from '../../../../../../../../utils/apis/LoopMsgAPi';
export default function InfoFeedback(props) {
    const [visible, setVisible,data] = useState();


    //const { data,item } = props;
    const [switchState, setSwitchState] = useState(false);
    const [tableData, setTableData] = useState(false);
    const [rgxcDataArray, setRgxcDataArray] = useState();
    const onOk = () => {
        setSwitchState(false)
    }


    useEffect(() => {
        LoopMsgAPi.rgxcList().then(e => {
            console.log("@", e.rows.map(e=>{
                    e.key=e.id
                    return e
            }))
            setRgxcDataArray(e.rows.map(e=>{
                e.key=e.id
                return e
        }))
            
        })
    }, [])
    //从接口拿数据，根据data的值，制作成dataSource
    const dataSource =rgxcDataArray?rgxcDataArray: [
        {
            key: '1',
            title: `XXXX风险信息1`,
            age: '待查看',
            address: '详情',
            zrr: '张三',
        },
       
    ];

    const columns = [
        {
            title: `风险信息名称`,
            dataIndex: 'ms',
            key: 'ms',
            width: 500,
        },
        {
            title: `责任人`,
            dataIndex: 'zrr',
            key: 'zrr',

        },
        {
            title: '反馈状态',
            dataIndex: 'age',
            key: 'age',
            render: (text, record) => {
                return <Button type="link" size="small" onClick={e => {
                    setSwitchState(true);
                    setTableData(record)
                    console.log(text, record)
                }}>待审批</Button>
            }
        },

    ];
    return <>
       
            <Table scroll={{ y: 300 }} pagination={false} dataSource={dataSource} columns={columns} />
            <Xq onOk={onOk} tableData={tableData} switchState={switchState}  />
       
    </>;
}